Skip to content

Change protected accessors #4568

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

odersky
Copy link
Contributor

@odersky odersky commented May 23, 2018

Generate protected accessors after pickling in a mini-phase.

Change rules so that accessors are also created for Scala-defined protected definitions, if
the access comes from outside the definitions visibility boundary and the class enclosing
the access is not a subclass. This prepares half of the way towards leaving such definitions
protected instead of widening their accessibility to public. The other half of the way would be
to forbid access from nested packages, but this will not be done in this PR.

Copy link
Member

@dottybot dottybot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, and thank you for opening this PR! 🎉

All contributors have signed the CLA, thank you! ❤️

Commit Messages

We want to keep history, but for that to actually be useful we have
some rules on how to format our commit messages (relevant xkcd).

Please stick to these guidelines for commit messages:

  1. Separate subject from body with a blank line
  2. When fixing an issue, start your commit message with Fix #<ISSUE-NBR>:
  3. Limit the subject line to 72 characters
  4. Capitalize the subject line
  5. Do not end the subject line with a period
  6. Use the imperative mood in the subject line ("Add" instead of "Added")
  7. Wrap the body at 80 characters
  8. Use the body to explain what and why vs. how

adapted from https://chris.beams.io/posts/git-commit

Have an awesome day! ☀️

@odersky odersky force-pushed the change-protected-accessors branch from 07174c6 to 1501dcb Compare May 23, 2018 13:13
@odersky
Copy link
Contributor Author

odersky commented May 23, 2018

It turns out that the rules governing super accessors and protected accessors are more subtle and intertwined than it looks at first. The root cause of this is that traits extend classes in Scala but not in the JVM.

odersky added 5 commits May 23, 2018 15:21
New phase to check protected accessors.

We now create accessors also for Scala symbols. Previously this was not done
as it was assumed that such symbols will always be mapped to public.

We create the accessors anyway in order to better test the functionality, so
that we can at some point avoid the access widening from protected to public.
Protected accessor names are no longer pickled, but inline accessors are.
Adapt name tags accordingly. Bump major Tasty version.
…classes

Superaccessors handles this already correctly by generating a super accessor in
this case.
Fix remaining problems, mostly having to do with choosing between
super accessors and protected accessors.
@odersky odersky force-pushed the change-protected-accessors branch from db116ff to 7777c70 Compare May 23, 2018 13:21
@odersky odersky requested a review from smarter May 23, 2018 19:52
odersky added a commit to dotty-staging/dotty that referenced this pull request May 26, 2018
Import AccessProxies changes from scala#4568
@odersky odersky assigned allanrenucci and unassigned smarter May 28, 2018
@allanrenucci allanrenucci deleted the change-protected-accessors branch May 29, 2018 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants